/* ========================================================================= */
/* ------------------------------------------------------------------------- */
/*!
  \file			cst_mnu.h
  \date			June 2011
  \author		TNick

  \brief		Contains the definition for CstMnu class


 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @n
 Please read ReadMe.txt and Licence.txt in root folder @n
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @n

*/
/* ------------------------------------------------------------------------- */
/* ========================================================================= */
#ifndef __CST_MNU_INC__
#define __CST_MNU_INC__
//
//
//
//
/*  INCLUDES    ------------------------------------------------------------ */

class	CstMnu;
class	CstAct;

#include	<QString>
#include	<QHash>
#include	<QStringList>

#include	<generic/cc_l2d.h>

/*  INCLUDES    ============================================================ */
//
//
//
//
/*  DEFINITIONS    --------------------------------------------------------- */


struct		CstMnuPrp	{
/*
	enum		CSTMNUFLAGS		{
		NONE		= 0x00000000,
		FLOATING	= 0x00000001,
		SHOWN		= 0x00000002,

		FLGMAX
	};

	/// tell if it's floating or docked
	CSTMNUFLAGS	flags;

	/// associated menu
	QMenu*		panel_w;
*/

	/// the name of this menu
	QString			s_name;

	/// list of actions; NULL signals a separator
	QList<CstAct*>	l_actions;

};



/*  DEFINITIONS    ========================================================= */
//
//
//
//
/*  CLASS    --------------------------------------------------------------- */

/// class representing a single customisable action
/**
*/
class CstMnu : public CC_L2D		{

	//
	//
	//
	//
	/*  DEFINITIONS    ----------------------------------------------------- */

	/*  DEFINITIONS    ===================================================== */
	//
	//
	//
	//
	/*  DATA    ------------------------------------------------------------ */

private:
	/// properties of this toolbar
	CstMnuPrp				data;


	/*  DATA    ============================================================ */
	//
	//
	//
	//
	/*  FUNCTIONS    ------------------------------------------------------- */

public:

	/// constructor;
	CstMnu		(void) : CC_L2D() {
		/*data.flags = CstMnuPrp::FLOATING;
		data.geom = QRect(0,0,0,0);
		data.panel_w = NULL;*/
		data.s_name = QObject::tr("new toolbar");
	}

	CstMnu		(QString s_name) : CC_L2D() {
		/*data.flags = (b_floating ? CstMnuPrp::FLOATING : CstMnuPrp::NONE);
		data.geom = QRect(0,0,0,0);
		data.panel_w = NULL;*/
		data.s_name = s_name;
	}

	/// destructor;
	virtual				~CstMnu		(void) {}


	/// set the name
	inline  void setName(QString s_new) {
		data.s_name = s_new;
	}
	/// get name
	inline QString name(void) const {
		return data.s_name;
	}

	/// copy the properties from another item
	inline void setProperties(const CstMnu* p_source)
	{ data = p_source->data; }
	/// set the properties from a data structure
	inline void setProperties(const CstMnuPrp* p_source)
	{ data = *p_source; }
	/// set the properties from a data structure but replace actions
	inline void setProperties(const CstMnuPrp* p_source,
							  QHash<CstAct*, CstAct*> transl)
	{
		data = *p_source;
		for (int i = 0; i < data.l_actions.count(); i++)
			{
				CstAct*	p_csta = data.l_actions.at(i);
				data.l_actions[i] = transl[p_csta];
			}
	}
	/// copy properties from another one
	inline void setProperties(const CstMnu* p_source,
							  QHash<CstAct*, CstAct*> transl)
	{
		setProperties(&p_source->data,transl);
	}

	/*  FUNCTIONS    ======================================================= */
	//
	//
	//
	//

};	/*	class CstMnu	*/

/*  CLASS    =============================================================== */
//
//
//
//
#endif // __CST_MNU_INC__
/* ------------------------------------------------------------------------- */
/* ========================================================================= */

